﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<GIFT_SHOP_MVC.Models.SanPham>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>EditProduct</title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
    <link href="../../Content/style.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
// <![CDATA[

        function image_onclick() {
            document.getElementById("Hinh").value = "../../Image_Product/" + document.getElementById("image").value.toString();
        }

// ]]>
    </script>
</head>
<body style="background:#e1d1d6;">
        <h2>Edit Product</h2>
        <%: Html.ValidationSummary(true) %>

        <%
            GIFT_SHOP_MVC.Models.GiftShop_LinQDataContext data = new GIFT_SHOP_MVC.Models.GiftShop_LinQDataContext();

            var lstcate = data.GetCategories();
            SelectList listcate = new SelectList(lstcate, "MaTheLoai", "TenTheLoai");
            var lstsup = data.GetSuppliers();
            SelectList listsup = new SelectList(lstsup, "MaNhaCungCap", "TenNhaCungCap");
            var lststt = data.GetProductStatus();
            SelectList liststt = new SelectList(lststt, "Ma_TT", "Ten");
             %>
        <form id="edit_pro" action="../../Admin/EditProduct" method="post" target="main_frame" enctype="multipart/form-data">
        <fieldset>
            <legend>Information</legend>

            <table class="style1" cellspacing="10">
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.TenSanPham) %></td>
                    <td>
                        <%: Html.TextBoxFor(model => model.TenSanPham) %>
                        <b style="color:Red;"><%: Html.ValidationMessageFor(model => model.TenSanPham) %></b></td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.MaTheLoai) %></td>
                    <td>
                        <%: Html.DropDownListFor(model => model.MaTheLoai,listcate) %></td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.MaNhaCungCap) %></td>
                    <td>
                        <%: Html.DropDownListFor(model => model.MaNhaCungCap,listsup) %></td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.Hinh) %></td>
                    <td>
                        <%: Html.HiddenFor(m=>m.Hinh)%>                   
                        <img width='150px' height='150px' alt='' src='<%=Model.Hinh %>' />
                        <input type="file" id="image" name="image" onchange="return image_onclick()" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.MoTa) %></td>
                    <td>
                        <%: Html.TextAreaFor(model => model.MoTa) %>
                        <b style="color:Red;"><%: Html.ValidationMessageFor(model => model.MoTa) %></b></td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.Gia) %></td>
                    <td>
                        <%: Html.TextBoxFor(model => model.Gia)%>
                        <b style="color:Red;"><%: Html.ValidationMessageFor(model => model.Gia) %></b></td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.LabelFor(model => model.Ma_TT) %></td>
                    <td>
                        <%: Html.DropDownListFor(model => model.Ma_TT,liststt) %></td>
                </tr>
                <tr>
                    <td align="right">
                        <%: Html.HiddenFor(model => model.MaSanPham) %></td>
                    <td>
                        <input type="submit" id="submit_btn" value="Save" /></td>
                </tr>
            </table>
        </fieldset>
        </form>
</body>
</html>

